-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check for entitlement in DBP agent #2802
Conversation
...ataBrokerProtection/Sources/DataBrokerProtection/Utils/DataBrokerProtectionAgentKiller.swift
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice one @Bunn. Overall approach LGTM! Protocols will allow us to test etc, which is great. I know it’s a WIP, but left a few small questions/comments anyway.
DuckDuckGo/DBP/DataBrokerProtectionSubscriptionEventHandler.swift
Outdated
Show resolved
Hide resolved
extension DataBrokerProtectionEntitlementMonitoring { | ||
func start(checkEntitlementFunction: @escaping () async throws -> Bool, callback: @escaping (DataBrokerProtectionEntitlementMonitorResult) -> Void) { | ||
start(checkEntitlementFunction: checkEntitlementFunction, | ||
intervalInMinutes: DataBrokerProtectionEntitlementMonitor.monitoringInterval, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: I don’t think it will cause issues, but something about the protocol extension referencing the concrete type static variable seems strange, or inverted. Maybe it’s a pattern, unsure, but wanted to highlight. Other options would be to just declare the constant in the function, or if we want every concrete type to have it’s own interval, define monitoringInterval
as a protocol requirement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Declaring the const in the function is the way to go IMO. The static const there is a leftover from some tests. Good call, thanks. I'll fix it
...okerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionAgentManager.swift
Outdated
Show resolved
Hide resolved
Co-authored-by: Pete Smith <[email protected]>
.../Sources/DataBrokerProtection/Authentication/DataBrokerProtectionEntitlementMonitoring.swift
Outdated
Show resolved
Hide resolved
...okerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionAgentManager.swift
Outdated
Show resolved
Hide resolved
...taBrokerProtection/Sources/DataBrokerProtection/Utils/DataBrokerProtectionAgentStopper.swift
Outdated
Show resolved
Hide resolved
...taBrokerProtection/Sources/DataBrokerProtection/Utils/DataBrokerProtectionAgentStopper.swift
Show resolved
Hide resolved
LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Utils/Logging.swift
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had a look at latest changes and they LGTM 👍🏼
...BrokerProtection/Tests/DataBrokerProtectionTests/DataBrokerProtectionAgentManagerTests.swift
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good @Bunn . All test steps passed. Left some comments, the main ones relating to tests.
...taBrokerProtection/Sources/DataBrokerProtection/Utils/DataBrokerProtectionAgentStopper.swift
Outdated
Show resolved
Hide resolved
...taBrokerProtection/Sources/DataBrokerProtection/Utils/DataBrokerProtectionAgentStopper.swift
Outdated
Show resolved
Hide resolved
...BrokerProtection/Tests/DataBrokerProtectionTests/DataBrokerProtectionAgentManagerTests.swift
Show resolved
Hide resolved
...BrokerProtection/Tests/DataBrokerProtectionTests/DataBrokerProtectionAgentManagerTests.swift
Show resolved
Hide resolved
...BrokerProtection/Tests/DataBrokerProtectionTests/DataBrokerProtectionAgentStopperTests.swift
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes mostly look good 👍🏼, but the added test needs to be changed. See the comment.
agentFinishedLaunchingExpectation.fulfill() | ||
}) | ||
|
||
// Then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are not awaiting the completion of the expectation here, so it’s reaching the asserts immediately, before any of the completion handlers are called. Also, if we want to wait for each completion, we will need multiple expectations.
# Conflicts: # DuckDuckGo/Application/AppDelegate.swift # DuckDuckGo/DBP/DataBrokerProtectionSubscriptionEventHandler.swift
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Latest changes LGTM 🎉
# By Fernando Bunn (3) and others # Via GitHub * main: Autofill engagement KPIs for pixel reporting (#2806) autofill: don't prefix autofill email pixels with `m.mac.` (#2808) Bump BSK (#2807) Make profile selector optional (#2811) Add History to iOS (updated UI and rollout) (#2770) New autofill save & update password prompt pixels for alignment with iOS (#2801) Add mylife data broker (#2786) Increase test timeout (#2810) Subscription refactoring, BSK update (#2809) Check for entitlement in DBP agent (#2802) move permanent survey card to first position (#2804) # Conflicts: # DuckDuckGo.xcodeproj/project.pbxproj
# By Elle Sullivan (8) and others # Via Elle Sullivan (3) and GitHub (2) * main: (26 commits) Autofill engagement KPIs for pixel reporting (#2806) autofill: don't prefix autofill email pixels with `m.mac.` (#2808) Bump BSK (#2807) Make profile selector optional (#2811) Add History to iOS (updated UI and rollout) (#2770) New autofill save & update password prompt pixels for alignment with iOS (#2801) Add mylife data broker (#2786) Increase test timeout (#2810) Subscription refactoring, BSK update (#2809) Check for entitlement in DBP agent (#2802) move permanent survey card to first position (#2804) Subscription refactoring (#2764) Bump version to 1.89.0 (191) Merge pir stabilization feature branch into main (#2789) Update age params for multiple brokers (#2800) Fix top level navigation blocks (#2792) Adding to the Dock automatically (#2722) Fix lint error Make activity only call completion once all work has actually finished Fix activity scheduler not calling completion ... # Conflicts: # DuckDuckGo.xcodeproj/project.pbxproj # DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
* main: (33 commits) Remove autofill survey (#2819) Bump version to 1.90.0 (192) Set marketing version to 1.90.0 Update embedded files Privacy Pro survey support (#2816) Update PeopleWhiz Broker Files to use hash id (#2814) Update BSK due to iOS changes. (#2776) Scroll address bar to caret when using arrows (#2799) Privacy Pro macOS quick follow ups (#2813) BSK bump for iOS RMF updates (#2798) Autofill engagement KPIs for pixel reporting (#2806) autofill: don't prefix autofill email pixels with `m.mac.` (#2808) Bump BSK (#2807) Make profile selector optional (#2811) Add History to iOS (updated UI and rollout) (#2770) New autofill save & update password prompt pixels for alignment with iOS (#2801) Add mylife data broker (#2786) Increase test timeout (#2810) Subscription refactoring, BSK update (#2809) Check for entitlement in DBP agent (#2802) ...
Task/Issue URL: https://app.asana.com/0/1201011656765697/1206366654222841/f
Description:
Deactivates the DBP agent if entitlements are invalid
Steps to test this PR:
The main changes here are in
DefaultDataBrokerProtectionAgentStopper
andDataBrokerProtectionSubscriptionEventHandler
which now checks for entitlement.rm -rf ~/Library/Group\ Containers/HKE973VLUW.com.duckduckgo.macos.browser.dbp.debug
andlaunchctl list | grep duck | awk '{print $3}' | xargs -n 1 launchctl remove
m_mac_dbp_macos_entitlement_valid
pixels